﻿@using PH.Model.Webs

<style>
    .t {border-bottom:dashed 1px #efefef; color:#666; font-family:"微软雅黑"; font-size:20px; padding:20px 0px;  }
    .t span { display:inline-block; width:10px; height:30px; background:#666; vertical-align: middle;}
    .b { color:#666; padding:20px;}
    .b a { color:#666; text-decoration:none;}

    .txtList {padding:10px; }
    .txtList li { height:35px; line-height:35px; font-size:13px;  }
    .txtList li a { color:#666;}
    .txtList li span { float:right; color:#999; vertical-align:top;*margin-top:-35px }
</style>
<div style="background-color:#fff">
    <div class="t">
        <span></span>
        @(((CaseModel)ViewBag.Case).CaseName)
    </div>
    <div class="b">
        <ul class="txtList"></ul>
        <div style="text-align: center;">
            <div id="paginator"></div>
        </div>
    </div>
</div>
<script>
    $("#paginator").bootstrapPaginator({
        currentPage: 1,
        totalPages: 1,
        onPageChanged: function (e, o, n) {
            GetList(n - 1);
        }
    });

    function GetList(pi) {
        var pageSize = 10;
        var lst = Whale.Remote.GetCollection({
            url: "/Portal/GetPages",
            parameters: {
                pageSize: pageSize,
                pageIndex: pi,
                caseID: "@(((CaseModel)ViewBag.Case).ID)"
            }
        });

        if (lst != null) {
            var tp = lst.Total / pageSize + (lst.Total % pageSize > 0 ? 1 : 0)
            $("#paginator").bootstrapPaginator({ totalPages: tp });

            var html = "";
            $.each(lst.Data, function (i, o) {
                html += "<li>";
                html += " <a href='" + o.FriendUrl + "' target='_blank'>" + o.Title + "</a>";
                html += "<span>" + o.CreatedOn.substr(0, 10) + "</span></li>";
            });
            $(".txtList").html(html);
        }
    }
    GetList(0);
</script>
